- type = local_assigns.fetch(:type)
- show_sorting_dropdown = local_assigns.fetch(:show_sorting_dropdown, true)
- disable_target_branch = local_assigns.fetch(:disable_target_branch, false)
- placeholder = local_assigns[:placeholder] || _('Search or filter results...')
- block_css_class = type != :productivity_analytics ? 'row-content-block second-block' : ''

.issues-filters
  .issues-details-filters.filtered-search-block.d-flex.flex-column.flex-lg-row{ class: block_css_class }
    .d-flex.flex-column.flex-md-row.flex-grow-1.mb-lg-0.mb-md-2.mb-sm-0.w-100
      = form_tag page_filter_path, method: :get, class: 'filter-form js-filter-form w-100' do
        - if params[:search].present?
          = hidden_field_tag :search, params[:search]
        - if @can_bulk_update
          .check-all-holder.gl-display-none.gl-sm-display-block.hidden.gl-float-left.gl-mr-3.gl-line-height-36
            = render Pajamas::CheckboxTagComponent.new(name: 'check-all-issues', value: nil) do |c|
              - c.with_label do
                %span.gl-sr-only
                  = _('Select all')
        .issues-other-filters.filtered-search-wrapper.d-flex.flex-column.flex-md-row
          .filtered-search-box
            - if type != :boards
              - text = tag.span(sprite_icon('history'), class: "d-md-none") + tag.span(_('Recent searches'), class: "d-none d-md-inline")
              = dropdown_tag(text,
                options: { wrapper_class: "filtered-search-history-dropdown-wrapper",
                toggle_class: "gl-button btn btn-default filtered-search-history-dropdown-toggle-button",
                dropdown_class: "filtered-search-history-dropdown",
                content_class: "filtered-search-history-dropdown-content" }) do
                .js-filtered-search-history-dropdown{ data: { full_path: search_history_storage_prefix } }
            .filtered-search-box-input-container.droplab-dropdown
              .scroll-container
                %ul.tokens-container.list-unstyled
                  %li.input-token
                    %input.form-control.filtered-search{ search_filter_input_options(type, placeholder) }
              #js-dropdown-hint.filtered-search-input-dropdown-menu.dropdown-menu.hint-dropdown
                %ul.filter-dropdown{ data: { dynamic: true, dropdown: true } }
                  %li.filter-dropdown-item{ data: {hint: "#{'{{hint}}'}", tag: "#{'{{tag}}'}", action: "#{'{{hint === \'search\' ? \'submit\' : \'\' }}'}" } }
                    %button.gl-button.btn.btn-link{ type: 'button' }
                      -# Encapsulate static class name `{{icon}}` inside #{} to bypass
                      -# haml lint's ClassAttributeWithStaticValue
                      %svg
                        %use{ 'xlink:href': "#{'{{icon}}'}" }
                      %span.js-filter-hint
                        {{formattedKey}}
              #js-dropdown-operator.filtered-search-input-dropdown-menu.dropdown-menu
                %ul.filter-dropdown{ data: { dropdown: true, dynamic: true } }
                  %li.filter-dropdown-item{ data: { value: "{{ title }}" } }
                    %button.gl-button.btn.btn-link{ type: 'button' }
                      {{ title }}
                      %span.btn-helptext
                        {{ help }}
              #js-dropdown-author.filtered-search-input-dropdown-menu.dropdown-menu
                - if current_user
                  %ul{ data: { dropdown: true } }
                    = render 'shared/issuable/user_dropdown_item',
                      user: current_user
                %ul.filter-dropdown{ data: { dynamic: true, dropdown: true } }
                  = render 'shared/issuable/user_dropdown_item',
                    user: User.new(username: '{{username}}', name: '{{name}}'),
                    avatar: { lazy: true, url: '{{avatar_url}}' }
              #js-dropdown-assignee.filtered-search-input-dropdown-menu.dropdown-menu
                %ul{ data: { dropdown: true } }
                  %li.filter-dropdown-item{ data: { value: 'None' } }
                    %button.gl-button.btn.btn-link{ type: 'button' }
                      = _('None')
                  %li.filter-dropdown-item{ data: { value: 'Any' } }
                    %button.gl-button.btn.btn-link{ type: 'button' }
                      = _('Any')
                  %li.divider.droplab-item-ignore
                  - if current_user
                    = render 'shared/issuable/user_dropdown_item',
                      user: current_user
                %ul.filter-dropdown{ data: { dynamic: true, dropdown: true } }
                  = render 'shared/issuable/user_dropdown_item',
                    user: User.new(username: '{{username}}', name: '{{name}}'),
                    avatar: { lazy: true, url: '{{avatar_url}}' }
              #js-dropdown-reviewer.filtered-search-input-dropdown-menu.dropdown-menu
                %ul{ data: { dropdown: true } }
                  %li.filter-dropdown-item{ data: { value: 'None' } }
                    %button.gl-button.btn.btn-link{ type: 'button' }
                      = _('None')
                  %li.filter-dropdown-item{ data: { value: 'Any' } }
                    %button.gl-button.btn.btn-link{ type: 'button' }
                      = _('Any')
                  %li.divider.droplab-item-ignore
                  - if current_user
                    = render 'shared/issuable/user_dropdown_item',
                      user: current_user
                %ul.filter-dropdown{ data: { dynamic: true, dropdown: true } }
                  = render 'shared/issuable/user_dropdown_item',
                    user: User.new(username: '{{username}}', name: '{{name}}'),
                    avatar: { lazy: true, url: '{{avatar_url}}' }
              = render_if_exists 'shared/issuable/approver_dropdown'
              = render_if_exists 'shared/issuable/approved_by_dropdown'
              #js-dropdown-milestone.filtered-search-input-dropdown-menu.dropdown-menu
                %ul{ data: { dropdown: true } }
                  %li.filter-dropdown-item{ data: { value: 'None' } }
                    %button.gl-button.btn.btn-link{ type: 'button' }
                      = _('None')
                  %li.filter-dropdown-item{ data: { value: 'Any' } }
                    %button.gl-button.btn.btn-link{ type: 'button' }
                      = _('Any')
                  %li.filter-dropdown-item{ data: { value: 'Upcoming' } }
                    %button.gl-button.btn.btn-link{ type: 'button' }
                      = _('Upcoming')
                  %li.filter-dropdown-item{ data: { value: 'Started' } }
                    %button.gl-button.btn.btn-link{ type: 'button' }
                      = _('Started')
                  %li.divider.droplab-item-ignore
                %ul.filter-dropdown{ data: { dynamic: true, dropdown: true } }
                  %li.filter-dropdown-item
                    %button.gl-button.btn.btn-link.js-data-value{ type: 'button' }
                      {{title}}
              = render_if_exists 'shared/issuable/filter_iteration', type: type
              #js-dropdown-release.filtered-search-input-dropdown-menu.dropdown-menu
                %ul{ data: { dropdown: true } }
                  %li.filter-dropdown-item{ data: { value: 'None' } }
                    %button.gl-button.btn.btn-link{ type: 'button' }
                      = _('None')
                  %li.filter-dropdown-item{ data: { value: 'Any' } }
                    %button.gl-button.btn.btn-link{ type: 'button' }
                      = _('Any')
                  %li.divider.droplab-item-ignore
                %ul.filter-dropdown{ data: { dynamic: true, dropdown: true } }
                  %li.filter-dropdown-item
                    %button.gl-button.btn.btn-link.js-data-value{ type: 'button' }
                      {{title}}
              #js-dropdown-label.filtered-search-input-dropdown-menu.dropdown-menu
                %ul{ data: { dropdown: true } }
                  %li.filter-dropdown-item{ data: { value: 'None' } }
                    %button.gl-button.btn.btn-link{ type: 'button' }
                      = _('None')
                  %li.filter-dropdown-item{ data: { value: 'Any' } }
                    %button.gl-button.btn.btn-link{ type: 'button' }
                      = _('Any')
                  %li.divider.droplab-item-ignore
                %ul.filter-dropdown{ data: { dynamic: true, dropdown: true } }
                  %li.filter-dropdown-item
                    %button.gl-button.btn.btn-link{ type: 'button' }
                      %span.dropdown-label-box{ style: 'background: {{color}}' }
                      %span.label-title.js-data-value
                        {{title}}
              #js-dropdown-my-reaction.filtered-search-input-dropdown-menu.dropdown-menu
                %ul{ data: { dropdown: true } }
                  %li.filter-dropdown-item{ data: { value: 'None' } }
                    %button.gl-button.btn.btn-link{ type: 'button' }
                      = _('None')
                  %li.filter-dropdown-item{ data: { value: 'Any' } }
                    %button.gl-button.btn.btn-link{ type: 'button' }
                      = _('Any')
                  %li.divider.droplab-item-ignore
                %ul.filter-dropdown{ data: { dynamic: true, dropdown: true } }
                  %li.filter-dropdown-item
                    %button.gl-button.btn.btn-link{ type: 'button' }
                      %gl-emoji
                      %span.js-data-value.gl-ml-3
                        {{name}}
              #js-dropdown-wip.filtered-search-input-dropdown-menu.dropdown-menu
                %ul.filter-dropdown{ data: { dropdown: true } }
                  %li.filter-dropdown-item{ data: { value: 'yes', capitalize: true } }
                    %button.gl-button.btn.btn-link{ type: 'button' }
                      = _('Yes')
                  %li.filter-dropdown-item{ data: { value: 'no', capitalize: true } }
                    %button.gl-button.btn.btn-link{ type: 'button' }
                      = _('No')
              - if ::Feature.enabled?(:mr_approved_filter, type: :ops)
                #js-dropdown-approved.filtered-search-input-dropdown-menu.dropdown-menu
                  %ul.filter-dropdown{ data: { dropdown: true } }
                    %li.filter-dropdown-item{ data: { value: 'yes', capitalize: true } }
                      %button.gl-button.btn.btn-link{ type: 'button' }
                        = _('Yes')
                    %li.filter-dropdown-item{ data: { value: 'no', capitalize: true } }
                      %button.gl-button.btn.btn-link{ type: 'button' }
                        = _('No')
              #js-dropdown-confidential.filtered-search-input-dropdown-menu.dropdown-menu
                %ul.filter-dropdown{ data: { dropdown: true } }
                  %li.filter-dropdown-item{ data: { value: 'yes', capitalize: true } }
                    %button.gl-button.btn.btn-link{ type: 'button' }
                      = _('Yes')
                  %li.filter-dropdown-item{ data: { value: 'no', capitalize: true } }
                    %button.gl-button.btn.btn-link{ type: 'button' }
                      = _('No')
              - unless disable_target_branch
                #js-dropdown-target-branch.filtered-search-input-dropdown-menu.dropdown-menu
                  %ul.filter-dropdown{ data: { dynamic: true, dropdown: true } }
                    %li.filter-dropdown-item
                      %button.gl-button.btn.btn-link.js-data-value.monospace
                        {{title}}
              #js-dropdown-environment.filtered-search-input-dropdown-menu.dropdown-menu
                %ul.filter-dropdown{ data: { dynamic: true, dropdown: true } }
                  %li.filter-dropdown-item
                    %button.gl-button.btn.btn-link.js-data-value{ type: 'button' }
                      {{title}}

              = render_if_exists 'shared/issuable/filter_weight', type: type

              = render_if_exists 'shared/issuable/filter_epic', type: type

            %button.clear-search.hidden.gl-rounded-base{ type: 'button' }
              = sprite_icon('close', size: 16, css_class: 'clear-search-icon')
    .filter-dropdown-container.gl-display-flex.gl-flex-direction-column.gl-md-flex-direction-row.gl-align-items-flex-start
      - if type != :productivity_analytics && show_sorting_dropdown
        = render 'shared/issuable/sort_dropdown'
